package com.yueban.net.service;

import com.yueban.constant.HttpConstant;
import com.yueban.model.BaseResponse;
import com.yueban.model.User;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by guan on 17-8-7.
 */

public interface UserService {
    @FormUrlEncoded
    @POST(HttpConstant.USER_LOGIN)
    Observable<BaseResponse<User>> login(@Field("account") String account,
                                         @Field("password") String password);

    @FormUrlEncoded
    @POST(HttpConstant.REGISTER)
    Observable<BaseResponse<User>> register(@Field("name") String uname,
                                            @Field("account") String account,
                                            @Field("password") String password);

    @GET(HttpConstant.GET_BASIC_USER_INFO)
    Observable<BaseResponse<User>> getUserInfo(@Query("userId") long userId);

    @GET(HttpConstant.SUBMIT_FEEDBACK)
    Observable<BaseResponse> submitFeedback(@Query("name") String name,
                                            @Query("phone") String phone,
                                            @Query("content") String content);

    @POST(HttpConstant.ADD_USER_ICON)
    Observable<BaseResponse> addUserIcon(@Body RequestBody requestBody);
}